package org.dromara.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.system.domain.XfCompanyOverallStatistics;
import org.dromara.system.domain.query.XfCompanyOverallStatisticsQuery;
import org.dromara.system.domain.vo.XfCompanyOverallStatisticsVo;
import org.dromara.system.mapper.XfCompanyOverallStatisticsMapper;
import org.dromara.system.service.IXfCompanyOverallStatisticsService;
import org.springframework.stereotype.Service;

import java.util.List;

@RequiredArgsConstructor
@Service
public class XfCompanyOverallStatisticsServiceImpl implements IXfCompanyOverallStatisticsService {
    
    private final XfCompanyOverallStatisticsMapper xfCompanyOverallStatisticsMapper;

    @Override
public List<XfCompanyOverallStatisticsVo> queryList(XfCompanyOverallStatisticsQuery query) {
        return xfCompanyOverallStatisticsMapper.queryList(query);
    }

    @Override
    public TableDataInfo<XfCompanyOverallStatisticsVo> queryPageList(XfCompanyOverallStatisticsQuery query, PageQuery pageQuery) {
        LambdaQueryWrapper<XfCompanyOverallStatistics> lqw = Wrappers.lambdaQuery();
        lqw.eq(query.getCompanyId() != null, XfCompanyOverallStatistics::getCompanyId, query.getCompanyId());
        Page<XfCompanyOverallStatisticsVo> page = xfCompanyOverallStatisticsMapper.selectPageXfCompanyOverallStatisticsList(pageQuery.build(), lqw);
        return TableDataInfo.build(page);
    }
}